<template>
  <div>
   <tables  : :loadDataApi="getCarTypes" v-on:onAdd="onAdd" v-on:onEdit="onEdit"  :tableCofig="tableConfig" ref="tables"  :columns="columns" />
 
  </div>
  
</template>

<script>
import Tables from '_c/tables'
import { getCarTypes, editCarType, delCarType} from '@/api/car/carApi'
export default {
  components: {
    Tables
  },
  data () {
    return {
    
      tableConfig:{
          idKey:'typeId',
          border:true,
          stripe:true,
          noDataText:'暂无车辆类型信息',
          action:{
                title:"操作",
                showDel:true,
                showEdit:true,
                width:200,
                buttons:[
                    {title:'结算',action:(params=>{
                        debugger;
                           this.$router.push('carTypeFeign')
                     })
                    }
                ]
          }
       },
      columns: [
        {type: 'selection',width:60,align:'center'},
        {title: '名称', key: 'typeName'},
        {title: '长度', key: 'lenght'},
        {title: '宽度', key: 'width'},
        {title: '高度', key: 'height'},
        {title: '载重量(Kg)', key: 'weight'},
        {title: '备注', key: 'remark', tooltip:true},
        {title: '创建时间', key: 'createTime',format:'date',align:'center'},
        {title: '创建人', key: 'createBy',width:80},
      ]
    }
  },
  methods: {
      
    add(){
          this.saveStatus=true;
          editCarType(this.formData)
          .then(res=>{
             this.saveStatus=false
             this.isShopPanel=false;
             this.$refs.tables.loadData();
          })
          .catch(err=>{
             this.saveStatus=false;
             this.$Message.error(err);
          });
    },
    onEdit(params){
        
    },
    onAdd(){
        this.isShopPanel=true;
    }
    
  },
  mounted () {
  }
}
</script>

<style>

</style>
